package com.tnovoselec.android.feed.handler.entity;

import java.util.ArrayList;
import java.util.List;

import com.tnovoselec.android.feed.handler.enums.MimeTypeEnum;

public class NewsDto extends ValidEntity {

    private String title;
    private String link;
    private String guid;
    private String author;
    private String lastBuildDate;
    private String pubDate;
    private String description;
    private String content;
    private String commentsLink;
    private Integer parentChannelId;

//    private List<ImageDto> images = new ArrayList<ImageDto>();
//    private List<VideoDto> videos = new ArrayList<VideoDto>();
    private List<EnclosureDto> enclosures = new ArrayList<EnclosureDto>();

    public NewsDto(Integer id) {
	super(id);
    }

    public NewsDto() {
	super();
    }

    public String getTitle() {
	return title;
    }

    public void setTitle(String title) {
	this.title = title;
    }

    public String getPubDate() {
	return pubDate;
    }

    public void setPubDate(String pubDate) {
	this.pubDate = pubDate;
    }

    public String getDescription() {
	return description;
    }

    public void setDescription(String description) {
	this.description = description;
    }

    // public List<ImageDto> getImages() {
    // return images;
    // }
    //
    // public void setImages(List<ImageDto> images) {
    // this.images = images;
    // }
    //
    // public List<VideoDto> getVideos() {
    // return videos;
    // }
    //
    // public void setVideos(List<VideoDto> videos) {
    // this.videos = videos;
    // }
    //
    // public void addImage(ImageDto image) {
    // images.add(image);
    // }
    //
    // public void addVideo(VideoDto video) {
    // videos.add(video);
    // }

    public String getLink() {
	return link;
    }

    public void setLink(String link) {
	this.link = link;
    }

    public String getGuid() {
	return guid;
    }

    public void setGuid(String guid) {
	this.guid = guid;
    }

    public String getAuthor() {
	return author;
    }

    public void setAuthor(String author) {
	this.author = author;
    }

    public String getLastBuildDate() {
	return lastBuildDate;
    }

    public void setLastBuildDate(String lastBuildDate) {
	this.lastBuildDate = lastBuildDate;
    }

    public String getContent() {
	return content;
    }

    public void setContent(String content) {
	this.content = content;
    }

    public String getCommentsLink() {
	return commentsLink;
    }

    public void setCommentsLink(String commentsLink) {
	this.commentsLink = commentsLink;
    }

    public List<EnclosureDto> getEnclosures() {
	return enclosures;
    }

    public void setEnclosures(List<EnclosureDto> enclosures) {
	this.enclosures = enclosures;
    }

    public long getParentChannelId() {
	return parentChannelId;
    }

    public void setParentChannelId(Integer parentChannelId) {
	this.parentChannelId = parentChannelId;
    }

    public List<EnclosureDto> getEnclosuresByType(MimeTypeEnum type) {

	ArrayList<EnclosureDto> items = new ArrayList<EnclosureDto>();
	for (EnclosureDto item : enclosures) {
	    if (item.getMimeType().matches(type.getRegex())) {
		items.add(item);
	    }
	}

	return items;
    }

    @Override
    public boolean isValid() {
	// TODO implement!
	return true;
    }

}
